package org.senseframework.support.orm.hbase.definition;

import org.apache.hadoop.hbase.util.Bytes;
import org.senseframework.support.orm.hbase.annotation.ColumnType;

import java.lang.reflect.Field;

/**
 * @author wangqian
 * @date 18/4/12 下午8:17
 */
public class HBaseColumnDefinition {

    private String family;
    private String qualifier;
    private String javaColumn;
    private Class type;
    private long timestamp;
    private Field field;
    private ColumnType columnType;
    private Class keyType;
    private Class valueType;

    public Class getKeyType() {
        return keyType;
    }

    public void setKeyType(Class keyType) {
        this.keyType = keyType;
    }

    public Class getValueType() {
        return valueType;
    }

    public void setValueType(Class valueType) {
        this.valueType = valueType;
    }

    public ColumnType getColumnType() {
        return columnType;
    }

    public void setColumnType(ColumnType columnType) {
        this.columnType = columnType;
    }

    public String getJavaColumn() {
        return javaColumn;
    }

    public void setJavaColumn(String javaColumn) {
        this.javaColumn = javaColumn;
    }

    public String getFamily() {
        return family;
    }

    public byte[] familyBytes() {
        if (family == null) {
            return null;
        }
        return Bytes.toBytes(family);
    }

    public void setFamily(String family) {
        this.family = family;
    }

    public String getQualifier() {
        return qualifier;
    }

    public byte[] qualifierBytes() {
        if (qualifier == null) {
            return null;
        }
        return Bytes.toBytes(qualifier);
    }

    public void setQualifier(String qualifier) {
        this.qualifier = qualifier;
    }

    public Class getType() {
        return type;
    }

    public void setType(Class type) {
        this.type = type;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public Field getField() {
        return field;
    }

    public void setField(Field field) {
        this.field = field;
    }


}
